<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>注册组件树</title>
    <script src="vue.js"></script>
    <style>
      .main {
        background-color: #f2f2f2;
        padding: 20px;
        border-radius: 5px;
      }
      .title {
        font-size: 24px;
        font-weight: bold;
        color: #333;
      }
      .content {
        font-size: 16px;
        color: #666;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <app-component></app-component>
    </div>
    <script>
      var title = {
        template: "<p class='title'>标题</p>",
      };
      var content = {
        template: "<p class='content'>正文内容</p>",
      };
      var header = {
        template: `
          <div class="main">
            <header-title></header-title>
            <header-content></header-content>                
          </div>
        `,
        components: {
          "header-title": title,
          "header-content": content,
        },
      };
      var vm = new Vue({
        el: "#app",
        components: {
          "app-component": header,
        },
      });
    </script>
  </body>
</html>
